<?php
/**
 * this is cloud search http request class test file
 *
 *
 */
require_once 'index.php';
require_once 'Framework/TestCase.php';
class MemcachedTest extends PHPUnit_Framework_TestCase 
{
    public function testMemcache()
    {
        $cacher = MemcacheFactory::create("query_memcache"); 
        $key  = "niced_name";
        $value= "niced_testing";
        $cacher->set($key, $value);
        $value_in_cache = $cacher->get($key);
        $this->assertTrue($value_in_cache == $value);
        echo "get memcache key ".$key.", value is ".$value_in_cache."\r\n";
    }

    public function testNamedSpaceMemcache()
    {
        $cacher = MemcacheFactory::create("query_memcache"); 
        $named_cacher = new NICED_NamespacedMemcache($cacher, "niced");
        $key  = "niced_named_key";
        $value= "niced_testing_testing";
        $named_cacher->set($key, $value);
        $value_in_cache = $named_cacher->get($key);
        $this->assertTrue($value_in_cache == $value);
        echo "get memcache key ".$key." from namespace memcache, value is ".$value_in_cache."\r\n";
    }

    /**
     * execute before class
     *
     */
    public static function setUpBeforeClass()
    {

    }

    /**
     * execute before case
     *
     */
    protected function setUp()
    {
    }

    /**
     *
     * execute before assert
     */
    protected function assertPreConditions()
    {

    }

    /**
     *
     * execute after assert
     */
    protected function assertPostConditions()
    {

    }

    /**
     * execute after case
     */
    protected function tearDown()
    {

    }

    /**
     * execute after class
     *
     */
    public static function tearDownAfterClass()
    {

    }


}//end class
